package com.example.knowledgeget1.KnowtCommon.Repository;

import com.example.knowledgeget1.KnowtCommon.Entity.Study;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface StudyRepository extends JpaRepository<Study, Long> {
    @Query("SELECT s.courseId FROM Study s WHERE s.stuId = ?1")
    List<Long> findCourseIdsByStudentId(Long stuId);

    @Query("SELECT s.stuId FROM Study s WHERE s.courseId = ?1")
    List<Long> findStudentIdsByCourseId(Long courseId);
}